import moment from "moment";
import { Schema } from 'mongoose';
import { dbConfig } from '../../config/db';

const { tables } = dbConfig;
const { userMsg } = tables;

export const userMsgSchema = new Schema({
  fromUser: {
    type: String,
    default: '',
  },
  toUser: {
    type: String,
    default: '',
  },
  message: {
    type: String,
    default: '',
  },
  type: {
    type: String,
    default: '',
  },
  time: {
    type: String,
    default: moment().unix(),
  },
  attachments: {
    type: Object,
    default: {},
  },
  coverImg: {
    type: String,
    default: '',
  }
}, {
  collection: userMsg
})